import Vue from 'vue';
import Router from 'vue-router';
import login from 'pages/login/login.vue';
import home from 'pages/home/home.vue';
import register from 'pages/register/register.vue';
import userInfo from 'pages/user/userInfo.vue';
import resetPassword from 'pages/user/resetPassword.vue';
import apartmentList from 'pages/apartment/apartmentList.vue';
import addApartment from 'pages/apartment/addApartment.vue';
import editApartment from 'pages/apartment/editApartment.vue';
import orderList from 'pages/order/orderList.vue';
Vue.use(Router);

export default new Router({
  routes: [
    {
      path: '/',
      name: '',
      redirect: '/login',
      hidden: true
    },
    {
      path: '/login',
      name: 'login',
      component: login,
      hidden: true
    },
    {
      path: '/home',
      name: 'home',
      component: home,
      hidden: true
    },
    {
      path: '/register',
      name: 'register',
      component: register,
      hidden: true
    },
    {
      path: '/',
      component: home,
      name: 'userManger',
      children: [
        {
          path: '/userInfo',
          component: userInfo,
          name: 'userInfo'
        },
        {
          path: '/resetPassword',
          component: resetPassword,
          name: 'resetPassword'
        }
      ]
    },
    {
      path: '/',
      component: home,
      name: 'apartment',
      children: [
        {
          path: '/apartmentList',
          component: apartmentList,
          name: 'apartmentList'
        },
        {
          path: '/addApartment',
          component: addApartment,
          name: 'addApartment'
        },
        {
          path: '/editApartment/:id',
          component: editApartment,
          name: 'editApartment'
        }
      ]
    },
    {
      path: '/',
      component: home,
      name: 'order',
      children: [
        {
          path: '/orderList',
          component: orderList,
          name: 'orderList'
        }
      ]
    }
  ]
});
